import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Kind from '../views/Kind.vue'
import Cart from '../views/Cart.vue'
import My from '../views/My.vue'
import Login from '../views/Login.vue'
import Register from '../views/register/Register.vue'
import Reg1 from '../views/register/Reg1.vue'
import Reg2 from '../views/register/Reg2.vue'
import Reg3 from '../views/register/Reg3.vue'
import Error from '../views/Error.vue'
import Detail from '../views/Detail.vue'
import Search from '../views/Search.vue'
import Footer from '../components/Footer/Footer'
import SetPassword from '../views/SetPassword.vue'
import Setting from '../views/Setting.vue'
import My_address from '../views/My_address.vue'
import Addadress from '../views/Addadress.vue'
import UpdateAddress from '../views/UpdateAddress.vue'
import Order from '../views/Order.vue'
import Payend from '../views/Payend.vue'
import Orderlist from '../views/Orderlist.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      Footer
    }
  },
  {
    path: '/kind',
    name: 'Kind',
    components: {
      default: Kind,
      Footer
    }
  }, 
  {
    path: '/cart',
    name: 'Cart',
    components: {
      default: Cart,
      Footer
    }
  },
  {
    path: '/my',
    name: 'My',
    components: {
      default: My,
      Footer
    }
  },
  {
    path:'/login',
    name:"Login",
    component:Login
  },
  {
    path:'/register',
    name:"Register",
    component:Register,
    redirect: '/register/one',
    children:[
      {
        path:"/register/one",
        name:"Reg1",
        component:Reg1
      },
      {
        path:"/register/two",
        name:"Reg2",
        component:Reg2
      },
      {
        path:"/register/three",
        name:"Reg3",
        component:Reg3
      },
    ]
  },
  {
    path: '/detail/:proid',
    name: 'Detail',
    component: Detail
  },
  {
    path: '/setting',
    name: 'Setting',
    component:Setting
  },
  {
    path: '/setpassword',
    name: 'SetPassword',
    component:SetPassword
  },
  {
    path: '/my_address',
    name: 'My_address',
    component:My_address
  },
  {
    path: '/addadress',
    name: 'Addadress',
    component:Addadress
  },
  {
    path: '/updateaddress/:addressid',
    name: 'UpdateAddress',
    component:UpdateAddress
  },
  {
    path: '/payend',
    name: 'Payend',
    component:Payend
  },
  {
    path: '/order/:time',
    name: 'Order',
    component:Order
  },
  {
    path: '/orderlist',
    name: 'Orderlist',
    component:Orderlist
  },
  {
    path: '/search/:keyword',
    name: 'Search',
    component: Search
  },
  {
    path: '*',//不是路由规则中的路由，就走error
    name: 'Error',
    component: Error
  },
]

const router = new VueRouter({
  routes
})

export default router
